﻿@{
    Layout = null;
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;" />
    <title>西安市班线客运安全管理系统</title>
    <link href="~/www/css/style.css" rel="stylesheet" type="text/css" />
    <style>
        .lcLogo {
            text-align: center;
            margin-bottom: 5%;
            color: #204c95;
            font-size: 1.2em;
        }
        .lcSub1 {
            background: #ccc;
            margin-top:10px;
        }
    </style>
</head>

<body>
    <div class="loginCen">
        <form id="frmRegist" action="@Url.Action("home", "M_Login")" method="post">
            <div class="lcLogo">修改密码</div>
            <input id="currentPwd" type="password" placeholder="当前密码" class="lcTxt" /><br />
            <input id="newPwd" type="password" placeholder="新密码" class="lcTxt" /><br />
            <input id="confirmPwd" type="password" placeholder="确认密码" class="lcTxt" /><br />
            <input id="btnSubmit" type="submit" value="保存" class="lcSub" />
            <input id="btnSubmit" type="submit" value="返回" class="lcSub lcSub1" />
        </form>
    </div>
    @Html.CdnImport("~/lib/jquery/jquery.js")
    @Html.CdnImport("~/lib/jquery-storageapi/jquery-storageapi.js")
    <script src="~/www/js/layer_mobile/layer.js"></script>
</body>
</html>
<script>
    $(document).ready(function () {
        $("#btnSubmit").click(function () {
            $.ajax({
        type: "POST",
        url: "/M_ModifyUserPassword/ModifyUserPassword",
        dataType: 'json',
        data: { currentPwd: $("#currentPwd").val(), newPwd: $("#newPwd").val() }, 
        success: function (data) {
            if (data.success) {
                layer.open({
                    content: '密码修改成功'
                    , btn: ['取消', '返回主页']
                    , skin: 'up'
                    , no: function (index) {
                        window.location.href = '/Mobile/M_Login/home';
                    }
                });
            }
            else
            {
                layer.open({
                    content: data.message
                    , btn: '我知道了'
                });
            }
                }
            });
            return false;
        });
    });  
</script>
